<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="./template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">

	<ui:define name="titulo">
	    <h:outputText  value="Cadastro de turmas"/>
	</ui:define>
	
    <ui:define name="body">
        <rich:panel id="panelBar" heigth="400" width="700">
            <f:facet name="header">Cadastro de turmas</f:facet>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputText value="Nome: " />
                    <h:inputText value="#{turmaController.turma.nome}" />
                </h:panelGrid>
                <h:commandButton value="Cadastrar" action="#{turmaController.salvar}" />
                <h:commandLink value="Voltar" action="INDEX" />
            </h:form>
            
            <rich:dataTable var="t" value="#{turmaController.lista}">
                <f:facet name="header">
                    <rich:columnGroup>
                        <rich:column>
                            <h:outputText value="Nome" />
                        </rich:column>                        
                        <rich:column>
                            <h:outputText value="Opcoes" />
                        </rich:column>
                    </rich:columnGroup>
                </f:facet>
                <rich:column>
                    <h:outputText value="#{t.nome}" />
                </rich:column>
                <rich:column>
                    <h:form>
                        <h:commandButton value="Editar" action="INDEX" />
                        <h:commandButton value="Excluir" action="#{turmaController.excluir}">
                            <f:param name="id" value="#{t.id}" />
                        </h:commandButton>
                    </h:form> 
                </rich:column>
            </rich:dataTable>
        </rich:panel>    
    </ui:define>
</ui:composition>